package com.xtaller.easy.admin.mapper;

import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.xtaller.easy.admin.model.SysMenuAuth;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
* Created by Taller on 2018/04/13
*/
@Mapper 
public interface SysMenuAuthMapper extends BaseMapper<SysMenuAuth> {
    @Update("update sys_menu_auth set isDel=1,reviser=#{reviser},reviseTime=#{reviseTime} " +
            "where menuId=#{menuId} and isDel=0 ")
    Boolean initAuthByMenuId(@Param("reviser") String reviser,
                             @Param("reviseTime") Long reviseTime,
                             @Param("menuId") String menuId);

    @Select("select * from v_menu_auth where menuId = #{menuId} ")
    List<JSONObject> getAuthByMenuId(@Param("menuId") String menuId);
}